<?php
//作者千柒qq743395324
namespace Admin\Controller;

use Think\Controller;

class IndexController extends Controller
{
    public function _initialize(){
            //判断用户是否已经登录
        if (!isset($_SESSION['username'])) {
         redirect('Admin/Login');
         exit;
        }
    }
   
    public function website()
    {
        $this-> data = M('website')->where('id=1')->find();
        $this->display();
    }
    public function jane_post()
    {
        $password = I('post.password','','htmlspecialchars');
        if(!$password){
            exit('请输入要修改的密码');
        }
        if(M('jane')->where('id=1')->save(['password'=>md5($password)])){
            echo '操作成功';
        }else{
            echo '无变动或出错';
        }
    }
    public function web_post()
    {
        $name = I('post.name','','htmlspecialchars');
        $title = I('post.title','','htmlspecialchars');
        $keywords = I('post.keywords','','htmlspecialchars');
        $description = I('post.description','','htmlspecialchars');
        $logo = I('post.logo','','htmlspecialchars');
        $ipc = I('post.ipc','','htmlspecialchars');
        $con = I('post.con','','htmlspecialchars');
        $type = I('post.type','','htmlspecialchars');
        echo $type;

        $data = array(
            'name'=>$name,
            'title'=>$title,
            'keywords'=>$keywords,
            'description'=>$description,
            'logo'=>$logo,
            'ipc'=>$ipc,
            'con'=>$con,
            'type'=>$type,

        );

        if(M('website')->where('id=1')->save($data)){
            echo '操作成功';
        }else{
            echo '信息无变动';
        }

    }

}
